import {	getUserInfo} from "./storage.js"	import {getToken} from '@/utils/token.js'
import{	getPaymentPasswordIsExist,	selectPaymentPassword,	insrtPaymentPassword,
	getPaymentPasswordIsExistForCom,
	insrtPaymentPasswordForCom,
	selectPaymentPasswordForCom,
	queryAccount, //个人余额
	companyQueryAccount //公司余额} from '@/common/api/pay.js'
//查询用户余额总额  
export const queryAccountFun = () => {	let params = {}
	getToken('version') == 1?params['userNo'] = getToken('useNum'):params['companyId'] = getToken('useNum')
	return getToken('version') == 1? queryAccount(params).then(res=>{
		let result = {}
		if(res.data && res.data.code == 200){
			result = res.data.listData
		}else{
			result = null
		}
		return result
	}): companyQueryAccount(params).then(res=>{
		let result = {}
		if(res.data && res.data.code == 200){
			result = res.data.listData
		}else{
			result = null
		}
		return result
	})}
//判断个人是否存在支付密码export const getPaymentPasswordIsExistFun = () => {	return getPaymentPasswordIsExist({		craftsmanId:getUserInfo()['craftsmanId']	})}//判断企业是否存在支付密码export const getPaymentPasswordIsExistFunComp = () => {
	return getPaymentPasswordIsExistForCom({
		companyId:getToken('complogin')['companyId']
	})
}
//设置个人支付密码export const insrtPaymentPasswordFun = (password) => {	return insrtPaymentPassword({		'craftsmanId':getUserInfo()['craftsmanId'],		'paymentPassword':password	})}//设置企业支付密码export const insrtPaymentPasswordFunComp = (password) => {
	return insrtPaymentPasswordForCom({
		'companyId':getToken('complogin')['companyId'],
		'paymentPassword':password
	})
}
//验证个人支付密码是否正确export const selectPaymentPasswordFun = (password) => {	return selectPaymentPassword({		'craftsmanId': getUserInfo()['craftsmanId'],		'paymentPassword':password	})}
//验证企业支付密码是否正确
export const selectPaymentPasswordFunComp = (password) => {
	return selectPaymentPasswordForCom({
		'companyId': getToken('complogin')['companyId'],
		'paymentPassword':password
	})}